<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://xmlns.jcp.org/jsf/html"
	xmlns:f="http://xmlns.jcp.org/jsf/core"
	xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
	xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
	
	
	xmlns:mywidgets="http://xmlns.jcp.org/jsf/composite/widgets">

<ui:composition template="/templates/contentTemplate.xhtml">

	#{pubController.init}
	<ui:define name="title">
		<c:if test="#{empty pubController.title}">NEW PUBLICATION</c:if>#{pubController.title}</ui:define>

	<ui:define name="navReferences">

		<c:if
			test="#{not empty pubController.pubsOfSameThreads and pubController.pubsOfSameThreads.size() > 1}">
			<ui:decorate
				template="/templates/decorators/navReferenceDecorator.xhtml">

				<ui:define name="title">Thread-related publications</ui:define>

				<ui:define name="content">
					<ui:repeat var="pub" value="#{pubController.pubsOfSameThreads}">

						<h:panelGroup class="threadReference"
							rendered="#{pubController.id != pub.id}" layout="block">
							<h:outputLink value="publication.jsf?pubId=#{pub.id}">
								<div class="threadReferenceDate" style="font-size: xx-small;">
									<h:outputText value="#{pub.dateCreated.time}" styleClass="date">
										<f:convertDateTime pattern="EEEE, MMMM d yyyy" />
									</h:outputText>
									&nbsp;
									<h:outputText value="#{pub.dateCreated.time}" styleClass="time">
										<f:convertDateTime pattern="hh:mm" />
									</h:outputText>
								</div>
						 		#{pub.title}						
							</h:outputLink>
						</h:panelGroup>

					</ui:repeat>

				</ui:define>
			</ui:decorate>
		</c:if>

		<c:if test="#{not empty pubController.pubThreads}">
			<ui:decorate
				template="/templates/decorators/navReferenceDecorator.xhtml">

				<ui:define name="title">Threads of this Publication</ui:define>

				<ui:define name="content">
					<ui:repeat var="thread" value="#{pubController.pubThreads}">
						<h:outputLink value="thread.jsf?tid=#{thread.id}">#{thread.name}</h:outputLink>
						<br />
					</ui:repeat>

				</ui:define>
			</ui:decorate>
		</c:if>


	</ui:define>

	<ui:define name="body">

		<!-- 2) später Erweiterung zu Pub+ Wie Twitter, Facebook, Blog, etc.
		 -->
		<mywidgets:tileFull pubId="#{pubController.id}" state="E" />

	</ui:define>
</ui:composition>
</html>
